using System;
using System.IO;
using System.Runtime.InteropServices;
namespace BMC.ARSystem
{
	[ARStructTypeInfo(Name = "ARAttachStruct", NumberOfMembers = 4u), ClassInterface, Guid("958dd5be-b361-4ee8-ae91-8ef0b0c95430"), ProgId("BMC.ARSystem.Attachment")]
	public class Attachment
	{
		[ARStructMemTypeInfo(Name = "name", Offset = 0u)]
		private string _name;
		[ARStructMemTypeInfo(Name = "origSize", Offset = 1u)]
		private int _origSize;
		[ARStructMemTypeInfo(Name = "compSize", Offset = 2u)]
		private int _compSize;
		private byte[] _content;
		public string Name
		{
			get
			{
				return this._name;
			}
			set
			{
				this._name = value;
			}
		}
		public int OrigSize
		{
			get
			{
				return this._origSize;
			}
		}
		public int CompSize
		{
			get
			{
				return this._compSize;
			}
		}
		public byte[] Content
		{
			get
			{
				return this._content;
			}
			set
			{
				this._content = value;
			}
		}
		public Attachment()
		{
		}
		public Attachment(string name, byte[] content)
		{
			this.SetValue(name, content);
		}
		public Attachment(string name, Stream stream)
		{
			this.SetValue(name, stream);
		}
		public Attachment(string name, string filePath)
		{
			this.SetValue(name, filePath);
		}
		public Attachment(string filePath)
		{
			this.SetValue(filePath, filePath);
		}
		[ComVisible(false)]
		public void SetValue(string name, byte[] bytes)
		{
			this._name = name;
			this._content = bytes;
			this._origSize = (this._compSize = bytes.Length);
		}
		[ComVisible(false)]
		public void SetValue(string name, string filePath)
		{
			string fullPath = Path.GetFullPath(filePath);
			FileStream fileStream = File.OpenRead(fullPath);
			this.SetValue(name, fileStream);
			fileStream.Close();
		}
		[ComVisible(false)]
		public void SetValue(string name, Stream stream)
		{
			byte[] array = new byte[stream.get_Length()];
			stream.Read(array, 0, (int)stream.get_Length());
			this.SetValue(name, array);
		}
		public void SetValue(string name, object any)
		{
			if (any is string)
			{
				this.SetValue(name, (string)any);
				return;
			}
			if (any is Stream)
			{
				this.SetValue(name, (Stream)any);
				return;
			}
			this.SetValue(name, (byte[])any);
		}
		public override string ToString()
		{
			return this.Name;
		}
	}
}
